package homework;

public class Draw {
    private int lineCount;
    public Draw(int lineCount){
        if(lineCount>3){
            this.lineCount=lineCount;
        }
    }
    public void Triangle(){
        for(int i=1;i<=lineCount;i++){
            for(int j=0;j<lineCount-1;j++){
                System.out.print(" ");
            }
            for(int k=0;k<=2*i-1;k++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
    public void Rectangle(){
        for(int i=0;i<lineCount;i++){
            for(int j=0;j<lineCount-1;j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
    public void Square(){
        for(int i=0;i<lineCount;i++){
            for(int j=0;j<lineCount;j++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
    public void Parallelogram(){
        for(int i=0;i<lineCount;i++){
            for(int j=0;j<i;j++){
                System.out.print(" ");
            }
            for(int k=0;k<lineCount;k++){
                System.out.print("*");
            }
            System.out.println();
        }
    }
    public static void main(String[] args){
        Draw draw=new Draw(4);
        System.out.println("三角形：");
        draw.Triangle();

        System.out.println("矩形：");
        draw.Rectangle();

        System.out.println("正方形：");
        draw.Square();

        System.out.println("平行四边形:");
        draw.Parallelogram();
    }
}
